home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / System-Boost / Workbench / Archive / XPK / xpk_Source / test / testSubLibData.c < prev    next >
C/C++ Source or Header  |  1998-11-15  |  4KB  |  144 lines

  1. #define NAME        "testSubLibData"
  2. #define DISTRIBUTION    "(Freeware) "
  3. #define REVISION    "3"
  4.  
  5. /* Programmheader
  6.  
  7.     Name:        testSubLibData
  8.     Author:        SDI
  9.     Distribution:    Freeware
  10.     Description:    prints data of sub libraries
  11.     Compileropts:    -
  12.     Linkeropts:    -
  13.  
  14.  1.1   06.12.96 : excluded PrintFlag functions
  15.  1.2   15.04.97 : renamed from GetXpkSubLibData
  16.  1.3   05.08.97 : needs no longer UPPER case arguments, now multiple
  17.     arguments
  18. */
  19.  
  20. #include <proto/xpksub.h>
  21. #include <proto/dos.h>
  22. #include <proto/exec.h>
  23. #include <xpk/xpksub.h>
  24. #include "SDI_defines.h"
  25. #include "PrintFlags.c"
  26.  
  27. #define PARAM        "LIBID/A/M"
  28.  
  29. struct Library *XpkSubBase    = 0;
  30. struct RDArgs  *rda        = 0;
  31. ULONG        DosVersion    = 37;
  32.  
  33. UBYTE toup(UBYTE a)
  34. {
  35.   if(a >= 'a' && a <= 'z')
  36.     return (UBYTE) (a+'A'-'a');
  37.   return a;
  38. }
  39.  
  40. void WriteMode(struct XpkMode *, ULONG);
  41.  
  42. void main(void)
  43. {
  44.   STRPTR name = "compressors/xpk____.library";
  45.   STRPTR *str;
  46.  
  47.   if((rda = ReadArgs(PARAM, (LONG *) &str, 0)) && str)
  48.   {
  49.     for(;*str; ++str)
  50.     {
  51.       struct XpkInfo *xi;
  52.       STRPTR str2;
  53.  
  54.       if((name[15] = toup((*str)[0])))
  55.         if((name[16] = toup((*str)[1])))
  56.           if((name[17] = toup((*str)[2])))
  57.             name[18] = toup((*str)[3]);
  58.  
  59.       if((XpkSubBase = OpenLibrary(name, 0)) &&
  60.       (xi = XpksPackerInfo()))
  61.       {
  62.         VPrintf(
  63.         "xi_XpkInfoVersion : %d\n"
  64.         "xi_LibVersion     : %d\n"
  65.         "xi_MasterVersion  : %d\n"
  66.         "xi_ModesVersion   : %d\n"
  67.         "xi_Name           : %s\n"
  68.         "xi_LongName       : %s\n"
  69.         "xi_Description    : %s\n"
  70.         ,xi);
  71.         str2 = (STRPTR) &(xi->xi_ID);
  72.         VPrintf("xi_ID             : '%.4s'\nxi_Flags          : ", &str2);
  73.         {
  74.           ULONG i = xi->xi_Flags;
  75.           PrintFlag(&i, XPKIF_PK_CHUNK,        "XPKIF_PK_CHUNK");
  76.           PrintFlag(&i, XPKIF_PK_STREAM,    "XPKIF_PK_STREAM");
  77.           PrintFlag(&i, XPKIF_PK_ARCHIVE,    "XPKIF_PK_ARCHIVE");
  78.           PrintFlag(&i, XPKIF_UP_CHUNK,        "XPKIF_UP_CHUNK");
  79.           PrintFlag(&i, XPKIF_UP_STREAM,    "XPKIF_UP_STREAM");
  80.           PrintFlag(&i, XPKIF_UP_ARCHIVE,    "XPKIF_UP_ARCHIVE");
  81.           PrintFlag(&i, XPKIF_HOOKIO,        "XPKIF_HOOKIO");
  82.           PrintFlag(&i, XPKIF_CHECKING,        "XPKIF_CHECKING");
  83.           PrintFlag(&i, XPKIF_PREREADHDR,    "XPKIF_PREREADHDR");
  84.           PrintFlag(&i, XPKIF_ENCRYPTION,    "XPKIF_ENCRYPTION");
  85.           PrintFlag(&i, XPKIF_NEEDPASSWD,    "XPKIF_NEEDPASSWD");
  86.           PrintFlag(&i, XPKIF_MODES,        "XPKIF_MODES");
  87.           PrintFlag(&i, XPKIF_LOSSY,        "XPKIF_LOSSY");
  88.           PrintFlag(&i, XPKIF_NOSEEK,        "XPKIF_NOSEEK");
  89.           PrintEndFlag(i, xi->xi_Flags);
  90.         }
  91.  
  92.         VPrintf(
  93.         "xi_MaxPkInChunk   : %ld\n"
  94.         "xi_MinPkInChunk   : %ld\n"
  95.         "xi_DefPkInChunk   : %ld\n"
  96.         "xi_PackMsg        : %s\n"
  97.         "xi_UnpackMsg      : %s\n"
  98.         "xi_PackedMsg      : %s\n"
  99.         "xi_UnpackedMsg    : %s\n"
  100.         "xi_DefMode        : %d\n"
  101.         "xi_Pad            : %d\n"
  102.         ,&(xi->xi_MaxPkInChunk));
  103.         VPrintf("xi_Reserved       : %ld,%ld,%ld,%ld,%ld,%ld\n", xi->xi_Reserved);
  104.  
  105.         WriteMode(xi->xi_ModeDesc, 1);
  106.       }
  107.     }
  108.   }
  109.   if(XpkSubBase)
  110.     CloseLibrary(XpkSubBase);
  111.   if(rda)
  112.     FreeArgs(rda);
  113. }
  114.  
  115. void WriteMode(struct XpkMode *m, ULONG num)
  116. {
  117.   STRPTR str = (STRPTR) &(m->xm_Description);
  118.   VPrintf("\nXpkMode No %ld:\n", &num);
  119.  
  120.   VPrintf("xm_Upto           : %ld\nxm_Flags          : ", &(m->xm_Upto));
  121.   {
  122.     ULONG i = m->xm_Flags;
  123.     PrintFlag(&i, XPKMF_A3000SPEED,    "XPKMF_A3000SPEED");
  124.     PrintFlag(&i, XPKMF_PK_NOCPU,    "XPKMF_PK_NOCPU");
  125.     PrintFlag(&i, XPKMF_UP_NOCPU,    "XPKMF_UP_NOCPU");
  126.     PrintEndFlag(i, m->xm_Flags);
  127.   }
  128.  
  129.   VPrintf(
  130.   "xm_PackMemory     : %ld\n"
  131.   "xm_UnpackMemory   : %ld\n"
  132.   "xm_PackSpeed      : %ld\n"
  133.   "xm_UnpackSpeed    : %ld\n"
  134.   "xm_Ratio          : %d\n"
  135.   "xm_ChunkSize      : %d\n"
  136.   , &(m->xm_PackMemory));
  137.  
  138.   VPrintf("xm_Description    : '%.10s'\n", &str);
  139.  
  140.   if(m->xm_Next)
  141.     WriteMode(m->xm_Next, num+1);
  142. }
  143.  
  144.